const cloud = require('wx-server-sdk')

cloud.init({
  // API 调用都保持和云函数当前所在环境一致
  env: cloud.DYNAMIC_CURRENT_ENV
})

exports.main = async (event, context) => {
  // 查询数据路数据
  const {page} = event
  const _SIZE = 10
  const _ = cloud.database().command
  const data = await cloud.database().collection('goods')
  .orderBy('updateTime', 'desc')
  .skip(page * _SIZE)
  .limit(10)
  .get()
  return data
}
